import React from 'react'
import { Link } from 'react-router-dom'
import { Helmet } from 'react-helmet'
import { useSelector, useDispatch } from 'react-redux';
import { incrementCounter } from '../../store/actions';

function Home() {
  const counter = useSelector(state => state.counter);
  const dispatch = useDispatch();

  return (
    <>
      <Helmet>
        <title>Home Page Title</title>
      </Helmet>
      <div onClick={() => console.log('click')}>
        Home works
        {/*测试客户端路由*/}
        <Link to={'/list'}>jump to list</Link>
      </div>

      <p>Counter: {counter}</p>
      <button onClick={() => dispatch(incrementCounter())}>Increment</button>
    </>
  )
}

export default Home;
